import request from 'request'
// 所有部门
export const departments = function () {
  return request({
    url: '/company/department'
  })
}
// 增加部门
export const addDepartment = function (data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}
// 删除部门
export const delDepartment = function (id) {
  return request({
    url: '/company/department/' + id,
    method: 'DELETE'
  })
}
// 获得部门详情
export const getEditDepartment = function (id) {
  return request({
    url: '/company/department/' + id
  })
}
// 编辑部门
export const editDepartment = function (id, data) {
  return request({
    url: '/company/department/' + id,
    method: 'PUT',
    data
  })
}
// 得到负责人
export const getPrincipal = function () {
  return request({
    url: '/sys/user/simple'
  })
}
// 获取个人信息
export function getUserDetailById (id) {
  return request({
    url: `/sys/user/${id}`
  })
}
// 修改个人信息
export function saveUserDetailById (id, data) {
  return request({
    url: `/sys/user/${id}`,
    method: 'put',
    data
  })
}
